#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
bool check(string s, int i, int j)
{
    for (int x = i; x <= j; x++)
    {
        for (int k = x + 1; k <= j; k++)
        {
            if (s[x] == s[k])
                return false;
        }
    }
    return true;
}
int lengthOfLongestSubstring(string s) {
    int ans = 0, n = s.size();
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            if (check(s, j, i))
            {
                ans = max(ans, i - j + 1);
            }
        }
    }
    return ans;
};
int main()
{
    string s("abccdefg");
    cout << lengthOfLongestSubstring(s) << endl;
    return 0;
}